package goover.unit01;
//冒泡排序
public class ForDemo02 {
    public static void main(String[] args){
        int[] array = {2,5,6,9,3,1,56,22};
        for(int i = 0; i < array.length - 1; i++){
            for(int j = 0; j < array.length - i - 1;j++){
                if(array[j] > array[j+1]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
        for(int i = 0;i < array.length;i++){
            if(i == array.length - 1){
                System.out.println(array[i]);
            }else {
                System.out.print(array[i] + ",");
            }
        }
    }
}
